#pragma once

//////////////////////////////////////////////////////////////////////////
//
// Timer used to calculate elapsed frame time and frames per seconds
//
//////////////////////////////////////////////////////////////////////////

#include <cstdint>

class Timer {
    uint64_t mLastStartTime;
    uint64_t mInPauseTime;
    uint64_t mLastStopTime;
    uint64_t mPreviousTickTime;
    uint64_t mCurrentTickTime;

    double mSecsPerCount;
    double mDeltaTime;

    bool mStopped;

public:
    Timer();

	// Returns the total time elapsed since reset() was called, 
	// NOT counting any time when the clock is stopped.
	float executionTime();

	// Call before message loop.
	void reset();

	// Call when unpaused.
	void start();

	// Call when paused.
	void stop();

	// Call every frame.
	void tick();

	double deltaTime() const { return mDeltaTime; }
};

